package com.itita.ww2.handler.requesthandler.account;

import com.smartfoxserver.v2.annotations.MultiHandler;
import com.itita.ww2.core.AbstractClientRequestHandler;

@MultiHandler
// @Instantiation(InstantiationMode.NEW_INSTANCE)
public class AccountHandler extends AbstractClientRequestHandler {
	public static final String COMMAND_PREFIX = "account"; // 前缀

	// private DatabaseReader reader; // GeoIP 读取器

	//	private void initialize() {
	//		// 读取GeoIp数据库
	//		try {
	//			File db = new File(
	//					ServerService.getInstance().getMainExtension().getCurrentFolder() + "db/GeoLite2-Country.mmdb"); // nullpointerException
	//			reader = new DatabaseReader.Builder(db).build();
	//		} catch (IOException | NullPointerException e) {
	//			e.printStackTrace();
	//		}
	//	}

	@Override
	protected void init() {
		// initialize();

		addClientRequestItem("autosignup", AutoSignUp.class); // 自动注册(初始账户)
		addClientRequestItem("setnickname", SetNickName.class);// 设置昵称
		addClientRequestItem("bind", BindAccount.class);// 绑定
		addClientRequestItem("retrieve", RetrieveAccount.class); // 找回游戏帐号(通过渠道帐号)
		addClientRequestItem("setFCMtoken", BindFCMToken.class); // 绑定fcm
	}

	//	@Override
	//	protected List<Object> getInitData() {
	//		List<Object> ret = super.getInitData();
	//		ret.add(reader);
	//		return ret;
	//	}

	@Override
	protected void setCommandPrefix() {
		super.cmd_prefix = COMMAND_PREFIX;
	}

}
